﻿using System.Collections.Generic;
using FrameworkManapro.BusinessModel;

namespace GMAC.ReportingSystem.Business.Entities
{
    /// <summary>
    /// Defines the access levels of the Users.
    /// </summary>
    [DbProcedures(Insert = "procRoleInsert", Update = "procRoleUpdate", Delete = "procRoleDelete")]
    public class Role : BusinessEntity
    {
        /// <summary>
        /// Gets or sets the role id.
        /// </summary>
        /// <value>The role id.</value>
        [EntityPrimaryKey]
        [DbParameter(0, 1, 1)]
        public int RoleID { get; set; }

        /// <summary>
        /// Gets or sets the name of the Role. (Maximum length: 50 characters.)
        /// </summary>
        /// <value>The name.</value>
        [DbParameter(1, 2, 0)]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the description of the Role. (Maximum length: 100 characters.)
        /// </summary>
        /// <value>The description.</value>
        [DbParameter(2, 3, 0)]
        public string Description { get; set; }

        /// <summary>
        /// Gets or sets the status of the Role.
        /// </summary>
        /// <value>The status of the Role.</value>
        [DbParameter(4, 5, 0)]
        public bool Status { get; set; }

        /// <summary>
        /// Gets or sets the Security items the Role has access to.
        /// </summary>
        /// <value>The security.</value>
        public Security Security { get; set; }

        /// <summary>
        /// Gets the XML representation of the Security items.
        /// </summary>
        /// <value>The security XML.</value>
        [DbParameter(3, 4, 0)]
        public string SecurityXml
        {
            get
            {
                return FrameworkManapro.Utilities.Serializer<Security>.WriteXml(this.Security);
            }
        }

    }

    public class RoleCollection : List<Role>
    { }
}
